]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Overview: apply extra padding to windows in external monitor
authorGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 13 Dec 2012 18:28:25 +0000 (19:28 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Fri, 18 Jan 2013 19:58:07 +0000 (20:58 +0100)
Add an style class targetting workspaces located outside the overview,
and use it for extra padding around the window clones. Padding is passed
down and applied inside LayoutStrategy, consolidating code that previously
handled the bottom side only.

https://bugzilla.gnome.org/show_bug.cgi?id=690171

data/theme/gnome-shell.css
js/ui/workspace.js

index c969f3e4d7641049752f74aeeb6aeed02de448f2..5b957e4bcd37527945e4685c9c0414b30a1f9989 100644 (file)
@@ -727,6 +727,10 @@ StScrollBar StButton#vhandle:active {
     -vertical-spacing: 32px;
 }
 
+.window-picker.external-monitor {
+    padding: 32px;
+}
+
 /* Dash */
 
 #dash {
@@ -751,10 +755,6 @@ StScrollBar StButton#vhandle:active {
     height: 24px;
 }
 
-#viewSelector {
-    spacing: 1em;
-}
-
 /* Search Box */
 
 #searchEntry {
index edcb04515082c92015e51595cccc149ca5da0dfb..a0d999d30a0d18d024a99fd514782d9aaebaaf4b 100644 (file)
@@ -746,11 +746,10 @@ const LayoutStrategy = new Lang.Class({
     Name: 'LayoutStrategy',
     Abstract: true,
 
-    _init: function(monitor, rowSpacing, columnSpacing, bottomPadding) {
+    _init: function(monitor, rowSpacing, columnSpacing) {
         this._monitor = monitor;
         this._rowSpacing = rowSpacing;
         this._columnSpacing = columnSpacing;
-        this._bottomPadding = bottomPadding;
     },
 
     _newRow: function() {
@@ -830,7 +829,7 @@ const LayoutStrategy = new Lang.Class({
         let area = layout.area;
 
         let hspacing = (layout.maxColumns - 1) * this._columnSpacing;
-        let vspacing = (layout.numRows - 1) * this._rowSpacing + this._bottomPadding;
+        let vspacing = (layout.numRows - 1) * this._rowSpacing;
 
         let spacedWidth = area.width - hspacing;
         let spacedHeight = area.height - vspacing;
@@ -864,7 +863,7 @@ const LayoutStrategy = new Lang.Class({
             y += row.height + this._rowSpacing;
         }
 
-        let height = y - this._rowSpacing + this._bottomPadding;
+        let height = y - this._rowSpacing;
         let baseY = (area.height - height) / 2;
 
         for (let i = 0; i < rows.length; i++) {
@@ -1038,6 +1037,8 @@ const Workspace = new Lang.Class({
         this._windowOverlaysGroup.set_size(0, 0);
 
         this.actor = new St.Widget({ style_class: 'window-picker' });
+        if (monitorIndex != Main.layoutManager.primaryIndex)
+            this.actor.add_style_class_name('external-monitor');
         this.actor.set_size(0, 0);
 
         this._dropRect = new Clutter.Rectangle({ opacity: 0 });
@@ -1624,7 +1625,7 @@ const Workspace = new Lang.Class({
         }
     },
 
-    _computeLayout: function(windows, area, rowSpacing, columnSpacing, bottomPadding) {
+    _computeLayout: function(windows, area, rowSpacing, columnSpacing) {
         // We look for the largest scale that allows us to fit the
         // largest row/tallest column on the workspace.
 
@@ -1640,7 +1641,7 @@ const Workspace = new Lang.Class({
                 break;
 
             let strategyClass = numRows > 2 ? GridLayoutStrategy : UnalignedLayoutStrategy;
-            let strategy = new strategyClass(this._monitor, rowSpacing, columnSpacing, bottomPadding);
+            let strategy = new strategyClass(this._monitor, rowSpacing, columnSpacing);
 
             let layout = { area: area, strategy: strategy, numRows: numRows, numColumns: numColumns };
             strategy.computeLayout(windows, layout);
@@ -1672,6 +1673,12 @@ const Workspace = new Lang.Class({
         // Window grid spacing
         let columnSpacing = node.get_length('-horizontal-spacing');
         let rowSpacing = node.get_length('-vertical-spacing');
+        let padding = {
+            left: node.get_padding(St.Side.LEFT),
+            top: node.get_padding(St.Side.TOP),
+            bottom: node.get_padding(St.Side.BOTTOM),
+            right: node.get_padding(St.Side.RIGHT),
+        };
 
         if (!totalWindows)
             return [];
@@ -1686,19 +1693,25 @@ const Workspace = new Lang.Class({
             [leftBorder, rightBorder] = overlay.chromeWidths();
         } else {
             [closeButtonHeight, captionHeight] = [0, 0];
+            [leftBorder, rightBorder] = [0, 0];
         }
 
         rowSpacing += captionHeight;
-        columnSpacing += rightBorder;
-
-        let area = { x: this._x, y: this._y, width: this._width, height: this._height };
-        area.y += closeButtonHeight;
-        area.height -= closeButtonHeight;
-        area.x += leftBorder;
-        area.width -= leftBorder;
+        columnSpacing += (rightBorder + leftBorder) / 2;
+        padding.top += closeButtonHeight;
+        padding.bottom += captionHeight;
+        padding.left += leftBorder;
+        padding.right += rightBorder;
+
+        let area = {
+            x: this._x + padding.left,
+            y: this._y + padding.top,
+            width: this._width - padding.left - padding.right,
+            height: this._height - padding.top - padding.bottom,
+        };
 
         if (!this._currentLayout)
-            this._currentLayout = this._computeLayout(windows, area, rowSpacing, columnSpacing, captionHeight);
+            this._currentLayout = this._computeLayout(windows, area, rowSpacing, columnSpacing);
 
         let layout = this._currentLayout;
         let strategy = layout.strategy;